//////////////////////////////////////////////////////////////////////////////////
//
//	Change Light
//		- Version 0.1
//		- 06.08.2006
//		- diamond-optic
//
//////////////////////////////////////////////////////////////////////////////////
//
// Information:
//
//   - Change brightness of the light in-game
//
// Settings:
//
//   - Lowercase "a" thru "z" with "a" being darkest and "z" being the brightest.
//   - You can also set combinations like "amzm" and it will cycle thru them.
//   - If you set it outside the range like "1" or whatnot, it will make everything
//     like super bright...
//
// CVARs:
//
//     amx_change_light "1"	//Turn On(1)/Off(0)
//     amx_change_light_brightness "m"	//sets the light level for when the map
//					//is loaded.. defualt level is "m"
//
// Console Commands:
//
//     amx_change_light_reload "m"	//Reload (or change) the brightness level
//					//during the game.
//
//////////////////////////////////////////////////////////////////////////////////
//
// Changelog:
//
//   - 06.08.2006 Version 0.1
//  	  Initial release
//
//////////////////////////////////////////////////////////////////////////////////

#include <amxmodx>
#include <engine>
#include <fakemeta>

new p_change_light, p_change_light_brightness

public plugin_init()
{
	register_plugin("Change Light", "0.1", "diamond-optic")
	
	register_cvar("amx_change_light_stats", "0.1", FCVAR_SERVER|FCVAR_SPONLY)
	
	p_change_light = register_cvar("amx_change_light", "1")
	p_change_light_brightness = register_cvar("amx_change_light_brightness", "m")
	
	register_concmd("amx_change_light_reload","force_lights",ADMIN_CVAR,"Change Light Brightness")
	
	set_task(1.0, "load_lights")
}

public load_lights()
{
	if (!get_pcvar_num(p_change_light))
		return PLUGIN_HANDLED
	
	new load_light[33]
	get_pcvar_string(p_change_light_brightness, load_light, 32)
	set_lights(load_light)
	
	
	return PLUGIN_HANDLED
}

public force_lights(id)
{
	if (!get_pcvar_num(p_change_light))
		return PLUGIN_HANDLED
		
	new reload_setting[32]
	read_argv(1, reload_setting, 32)
	
	set_lights(reload_setting)	

	return PLUGIN_HANDLED
}
